package com.gzu.ltms.controller.logistics;


import com.gzu.ltms.entity.dto.LogisticsDTO;
import com.gzu.ltms.response.Response;
import com.gzu.ltms.service.LogisticsService;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/logistics")
public class LogisticsController {

    @Resource
    private LogisticsService logisticsService;


    /**
     * 添加物流信息到Mongodb
     *
     * @param logisticsDTO
     * @return
     */
    @PostMapping("/add")
    public Response<?> addLogistics(@Validated @RequestBody LogisticsDTO logisticsDTO) {
        return logisticsService.addLogistics(logisticsDTO);
    }

    @GetMapping("/get/{id}")
    public Response<List<LogisticsDTO>> getLogisticsById(@PathVariable Long id) {
        return logisticsService.getLogisticsById(id);
    }

}
